home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / GETHSTS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-29  |  9.0 KB  |  287 lines

  1. VERSION 4.00
  2. Begin VB.Form frmGetHstSample 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "GetHst Sample Project"
  5.    ClientHeight    =   5025
  6.    ClientLeft      =   1470
  7.    ClientTop       =   1980
  8.    ClientWidth     =   7710
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   5430
  20.    Left            =   1410
  21.    LinkTopic       =   "Form1"
  22.    LockControls    =   -1  'True
  23.    ScaleHeight     =   5025
  24.    ScaleWidth      =   7710
  25.    Top             =   1635
  26.    Width           =   7830
  27.    Begin VB.CheckBox chkBlocking 
  28.       Caption         =   "Blocking (Synchronous)"
  29.       BeginProperty Font 
  30.          name            =   "MS Sans Serif"
  31.          charset         =   0
  32.          weight          =   400
  33.          size            =   8.25
  34.          underline       =   0   'False
  35.          italic          =   0   'False
  36.          strikethrough   =   0   'False
  37.       EndProperty
  38.       Height          =   255
  39.       Left            =   240
  40.       TabIndex        =   7
  41.       Top             =   1560
  42.       Width           =   3135
  43.    End
  44.    Begin VB.CommandButton cmdExit 
  45.       Cancel          =   -1  'True
  46.       Caption         =   "Exit"
  47.       BeginProperty Font 
  48.          name            =   "MS Sans Serif"
  49.          charset         =   0
  50.          weight          =   400
  51.          size            =   8.25
  52.          underline       =   0   'False
  53.          italic          =   0   'False
  54.          strikethrough   =   0   'False
  55.       EndProperty
  56.       Height          =   375
  57.       Left            =   4320
  58.       TabIndex        =   6
  59.       Top             =   1320
  60.       Width           =   3135
  61.    End
  62.    Begin VB.CommandButton cmdGetName 
  63.       Caption         =   "Translate IP Address To Host Name"
  64.       BeginProperty Font 
  65.          name            =   "MS Sans Serif"
  66.          charset         =   0
  67.          weight          =   400
  68.          size            =   8.25
  69.          underline       =   0   'False
  70.          italic          =   0   'False
  71.          strikethrough   =   0   'False
  72.       EndProperty
  73.       Height          =   375
  74.       Left            =   4320
  75.       TabIndex        =   5
  76.       Top             =   720
  77.       Width           =   3135
  78.    End
  79.    Begin VB.CommandButton cmdGetAddress 
  80.       Caption         =   "Translate Host Name To IP Address"
  81.       BeginProperty Font 
  82.          name            =   "MS Sans Serif"
  83.          charset         =   0
  84.          weight          =   400
  85.          size            =   8.25
  86.          underline       =   0   'False
  87.          italic          =   0   'False
  88.          strikethrough   =   0   'False
  89.       EndProperty
  90.       Height          =   375
  91.       Left            =   4320
  92.       TabIndex        =   4
  93.       Top             =   240
  94.       Width           =   3135
  95.    End
  96.    Begin VB.TextBox txtIPAddress 
  97.       BeginProperty Font 
  98.          name            =   "MS Sans Serif"
  99.          charset         =   0
  100.          weight          =   400
  101.          size            =   8.25
  102.          underline       =   0   'False
  103.          italic          =   0   'False
  104.          strikethrough   =   0   'False
  105.       EndProperty
  106.       Height          =   285
  107.       Left            =   240
  108.       TabIndex        =   3
  109.       Top             =   1080
  110.       Width           =   3735
  111.    End
  112.    Begin VB.TextBox txtHostName 
  113.       BeginProperty Font 
  114.          name            =   "MS Sans Serif"
  115.          charset         =   0
  116.          weight          =   400
  117.          size            =   8.25
  118.          underline       =   0   'False
  119.          italic          =   0   'False
  120.          strikethrough   =   0   'False
  121.       EndProperty
  122.       Height          =   285
  123.       Left            =   240
  124.       TabIndex        =   1
  125.       Top             =   480
  126.       Width           =   3735
  127.    End
  128.    Begin VB.Label Label5 
  129.       Caption         =   $"gethsts.frx":0000
  130.       BeginProperty Font 
  131.          name            =   "MS Sans Serif"
  132.          charset         =   0
  133.          weight          =   400
  134.          size            =   8.25
  135.          underline       =   0   'False
  136.          italic          =   0   'False
  137.          strikethrough   =   0   'False
  138.       EndProperty
  139.       Height          =   855
  140.       Left            =   240
  141.       TabIndex        =   10
  142.       Top             =   3960
  143.       Width           =   7215
  144.    End
  145.    Begin VB.Label Label4 
  146.       Caption         =   $"gethsts.frx":0180
  147.       BeginProperty Font 
  148.          name            =   "MS Sans Serif"
  149.          charset         =   0
  150.          weight          =   400
  151.          size            =   8.25
  152.          underline       =   0   'False
  153.          italic          =   0   'False
  154.          strikethrough   =   0   'False
  155.       EndProperty
  156.       Height          =   855
  157.       Left            =   240
  158.       TabIndex        =   9
  159.       Top             =   3000
  160.       Width           =   7215
  161.    End
  162.    Begin GetHstLib.GetHst GetHst1 
  163.       Left            =   0
  164.       Top             =   0
  165.       _Version        =   327680
  166.       _ExtentX        =   847
  167.       _ExtentY        =   847
  168.       _StockProps     =   64
  169.       Host            =   ""
  170.       HostAddress     =   ""
  171.       Blocking        =   -1  'True
  172.    End
  173.    Begin VB.Label Label3 
  174.       Caption         =   $"gethsts.frx":02C9
  175.       BeginProperty Font 
  176.          name            =   "MS Sans Serif"
  177.          charset         =   0
  178.          weight          =   400
  179.          size            =   8.25
  180.          underline       =   0   'False
  181.          italic          =   0   'False
  182.          strikethrough   =   0   'False
  183.       EndProperty
  184.       Height          =   615
  185.       Left            =   240
  186.       TabIndex        =   8
  187.       Top             =   2280
  188.       Width           =   7215
  189.    End
  190.    Begin VB.Label Label2 
  191.       Caption         =   "IP Address:"
  192.       BeginProperty Font 
  193.          name            =   "MS Sans Serif"
  194.          charset         =   0
  195.          weight          =   400
  196.          size            =   8.25
  197.          underline       =   0   'False
  198.          italic          =   0   'False
  199.          strikethrough   =   0   'False
  200.       EndProperty
  201.       Height          =   255
  202.       Left            =   240
  203.       TabIndex        =   2
  204.       Top             =   840
  205.       Width           =   2775
  206.    End
  207.    Begin VB.Label Label1 
  208.       Caption         =   "Host Name:"
  209.       BeginProperty Font 
  210.          name            =   "MS Sans Serif"
  211.          charset         =   0
  212.          weight          =   400
  213.          size            =   8.25
  214.          underline       =   0   'False
  215.          italic          =   0   'False
  216.          strikethrough   =   0   'False
  217.       EndProperty
  218.       Height          =   255
  219.       Left            =   240
  220.       TabIndex        =   0
  221.       Top             =   240
  222.       Width           =   2775
  223.    End
  224. Attribute VB_Name = "frmGetHstSample"
  225. Attribute VB_Creatable = False
  226. Attribute VB_Exposed = False
  227. Option Explicit
  228. Dim LastAction As Integer
  229. Private Sub cmdExit_Click()
  230.     End
  231.     End Sub
  232. Private Sub cmdGetAddress_Click()
  233.     ' Translate host name to IP address
  234.     txtIPAddress = ""
  235.     GetHst1.Blocking = chkBlocking
  236.     GetHst1.Host = txtHostName
  237.     GetHst1.Action = 1
  238.     ' If  blocking, show IP to user.
  239.     If chkBlocking Then
  240.         txtIPAddress = GetHst1.HostAddress
  241.         LastAction = 0
  242.     Else
  243.         LastAction = 1
  244.         ' Disable buttons so user doesn't
  245.         ' fire extra queries.  Display
  246.         ' of results is handled in the Done
  247.         ' event
  248.         cmdGetName.Enabled = False
  249.         cmdGetAddress.Enabled = False
  250.         cmdExit.Enabled = False
  251.         End If
  252.     End Sub
  253. Private Sub cmdGetName_Click()
  254.     ' Translate IP address to host name
  255.     txtHostName = ""
  256.     GetHst1.Blocking = chkBlocking
  257.     GetHst1.HostAddress = txtIPAddress
  258.     GetHst1.Action = 2
  259.     ' If  blocking, show IP to user.
  260.     If chkBlocking Then
  261.         txtHostName = GetHst1.Host
  262.         LastAction = 0
  263.     Else
  264.         LastAction = 2
  265.         ' Disable buttons so user doesn't
  266.         ' fire extra queries.  Display
  267.         ' of results is handled in the Done
  268.         ' event
  269.         cmdGetName.Enabled = False
  270.         cmdGetAddress.Enabled = False
  271.         cmdExit.Enabled = False
  272.         End If
  273.     End Sub
  274. Private Sub GetHst1_Done(ErrorCode As Integer)
  275.     ' Translation done, re-enable buttons.
  276.     cmdGetName.Enabled = True
  277.     cmdGetAddress.Enabled = True
  278.     cmdExit.Enabled = True
  279.     ' Display text based on action taken
  280.     Select Case LastAction
  281.         Case 1: ' get host address
  282.             txtIPAddress = GetHst1.HostAddress
  283.         Case 2: ' get host name
  284.             txtHostName = GetHst1.Host
  285.         End Select
  286.     End Sub
  287.